<% content_for :javascript do %>
<%= javascript_include_tag 'dcmgr_gui/network_panel.js' %>
<%= javascript_include_tag 'ui.selectmenu.js' %>
<script type="text/javascript">
  jQuery(function($){
  dcmgrGUI.networkPanel();
  });
</script>
<% end %>

<% content_for :stylesheet do %>
<style type="text/css">
  .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { text-align:center; float: none;}
  .ui-dialog .ui-dialog-content {margin:5px;}
  .ui-selectmenu-status { margin-top: 1px; }
</style>
<% end %>

<div id="mainarea_wide">
  <h3><img src="images/icon_resource.gif" /><%= t("networks.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div id="list_load_mask" class="maincontent">
    <div class="controller clearfix">
      <a href="javascript:void(0);" class="create_network"><%= t("networks.button.create_network") %></a>
      <a href="javascript:void(0);" class="refresh" style="margin-left:585px"><%= t("button.refresh") %></a>
    </div>
    
    <div class="controller clearfix">
      <div id="pagenate" class="r_float">
	<a href="javascript:void(0);" class="prev"></a>
	<p id="viewPagenate"></p>
	<a href="javascript:void(0);" class="next"></a>
      </div>
    </div>
    <div id="display_networks" class="display_area">
      <% content_for :javascript_template do %>
      <script id="networksListTemplate" type="text/x-jquery-tmpl">
	<table class="ptn01" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr> 
	    <th></th>
	    <th><%= t("networks.list.display_name") %></th>
	    <th><%= t("networks.list.ipv4_network") %></th>
	    <th><%= t("networks.list.domain_name") %></th>
	    <th><%= t("networks.list.action") %></th>
	  </tr>
	  {{each(index,item) rows}}
	  <tr id="row-${item.uuid}">
	    {{if item.uuid }}
	    <td class="listcheckbox"><input type="checkbox" value="${item.uuid}" > </td>
	    {{else}}
	    <td class="listcheckbox"></td>
	    {{/if}}
	    <td class="vtip display name" title="display-name">${item.display_name}</td>
	    <td class="vtip ipv4 network" title="ipv4-network">${item.ipv4_network}</td>
	    <td class="vtip domain name" title="domain-name">${item.domain_name}</td>
	    {{if item.uuid}}
            <td class="vtip center" title="action">
	      {{if item.editable}}
              <a href="javascript:void(0);" class="edit_network" id="edit_${item.uuid}"><%= t('networks.button.edit_network') %></a>
              {{else}}
              <a href="javascript:void(0);" class="edit_network" id="edit_${item.uuid}"><%= t('networks.button.view_network') %></a>
              {{/if}}
            </td>
            {{else}}
            <td class="vtip center" title="action"></td>
            {{/if}}
	  </tr>
	  {{/each}}
	</table>
      </script>
      <% end %>
    </div>
  </div>
  <div id="btm_maincontent_wide"></div>
  <h3><img src="images/icon_ttl_detail.gif" /><%= t("networks.details.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div id="detail" class="maincontent">
    <% content_for :javascript_template do %>
    <script id="networksDetailTemplate" type="text/x-jquery-tmpl">
      <div id="${item.uuid}" class="display_area">
	<h4 class="ptn01"><%= t("networks.details.network_id") %>:<span class="instansid">${item.uuid}</span></h4>
	<table class="ptn02" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.network_id") %>:</td>
	    <td class="state">${item.uuid}</td>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.display_name") %>:</td>
	    <td class="state">${item.display_name}</td>
	  </tr>
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.domain_name") %>:</td>
	    <td class="state">${item.domain_name}</td>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.ipv4_network") %>:</td>
	    <td class="state">${item.ipv4_network}</td>
	  </tr>
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.ipv4_gw") %>:</td>
	    <td class="state" colspan="7">${item.ipv4_gw}</td>
	  </tr>
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.created_at") %>:</td>
	    <td colspan="7">${item.created_at}</td>
	  </tr>
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("networks.details.updated_at") %>:</td>
	    <td colspan="7">${item.updated_at}</td>
	  </tr>
	</table>
      </div>
    </script>
    <% end %>
  </div><!-- maincontent -->
  <div id="btm_maincontent_wide_last"></div>
</div><!-- mainarea_wide -->
